package cc.eddic.practice.spring.dto;


import cc.eddic.practice.spring.domain.Option;
import cc.eddic.practice.spring.domain.Question;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.val;
import org.springframework.beans.BeanUtils;

import java.time.LocalDateTime;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OptionResponse {

    private long id;

    private String answer;
    private char choice;
    private boolean isCorrectAnswer;
    private Question question;
    private LocalDateTime createdOn;
    private LocalDateTime updatedOn;
    private Integer version;

    public static OptionResponse from(final Option option){
        val dto=new OptionResponse();
        BeanUtils.copyProperties(option,dto);
        return dto;
    }
}
